﻿using Architecture.Api.Application.Commands.CultureCommand;
using Architecture.Domain.Services.Interface;
using Architecture.Domain.TraceabilityManage;
using MediatR;

namespace Architecture.Api.Application.CommandHandlers.CultureHandler
{
    public class CultureUpdateCommandHandler : IRequestHandler<CultureUpdateCommand, int>
    {
        private readonly ICultureService _cultureService;

        public CultureUpdateCommandHandler(ICultureService cultureService)
        {
            _cultureService = cultureService;
        }

        public async Task<int> Handle(CultureUpdateCommand request, CancellationToken cancellationToken)
        {
            return await _cultureService.UpdateCultures(new Culture()
            {
                Brand = request.Brand,
                CId = request.CId,
                DynamicVerification = request.DynamicVerification,
                FarmId = request.FarmId,
                FeedingDays = request.FeedingDays,
                PersonIncharge = request.PersonIncharge,
                PublicationDate = request.PublicationDate,
                ProductionLot = request.ProductionLot,
                Breed = request.Breed,
                Source = request.Source,
                //CreateBy = request.CreateBy,
                //CreateDate = request.CreateDate,
                //IsDelete = request.IsDelete,
                //UpdateBy = request.UpdateBy,
                //UpdateDate = request.UpdateDate
            });
        }
    }
}
